package org.linlinjava.litemall.db.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.linlinjava.litemall.db.dao.SystemLogMapper;
import org.linlinjava.litemall.db.models.SystemLog;
import org.linlinjava.litemall.db.service.SystemLogService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;


@Service
public class SystemLogServiceImpl extends ServiceImpl<SystemLogMapper, SystemLog>
        implements SystemLogService {

    @Override
    public IPage<SystemLog> querySelective(String name, Integer pageNo, Integer pageSize) {
        Page<SystemLog> page = new Page<>(pageNo, pageSize);
        QueryWrapper<SystemLog> query = new QueryWrapper<>();
        query.like(!StringUtils.isEmpty(name), "name", name);
        query.orderByDesc("id");
        return baseMapper.selectPage(page, query);
    }
}
